package com.xindong.paking.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xindong.paking.entity.TbUser;
import com.xindong.paking.entity.vo.TbUserVo;
import com.xindong.paking.mapper.TbUserMapper;
import com.xindong.paking.service.PersonalModularService;
import com.xindong.paking.utils.UserInfoUtil;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Map;

/**
 * @Author jielun
 * @Date 2023/1/6 11:23
 * @Version 1.0
 */
@Service
public class PersonalModularServiceImpl extends ServiceImpl<TbUserMapper, TbUser> implements PersonalModularService {
    @Override
    public TbUserVo getUser() {
        Map<String, Object> userInfo = UserInfoUtil.getUserInfo();
        TbUserVo tbUserVo = new TbUserVo();
        tbUserVo.setBirth(LocalDateTime.parse(userInfo.get("birth").toString()));
        tbUserVo.setEmail(userInfo.get("email").toString());
        tbUserVo.setUsername(userInfo.get("username").toString());
        tbUserVo.setGender(userInfo.get("gender").toString());
        tbUserVo.setPhone(userInfo.get("phone").toString());
        tbUserVo.setRealname("realname");
        return tbUserVo;
    }
}
